package junit;
import static org.junit.Assert.*;

import java.util.ArrayList;
import java.util.List;

import main.Menu;
import main.Profession;

import org.junit.Before;
import org.junit.Test;

import enums.RationLevel;
import enums.TravelPace;

/**

/**
 * This tests the StartUpMenu method.
 *
 * @author Ira
 *
 */
public class MenuTest {

	Menu m;
	List<String> partyNames;
	private final int FARMER_MONEY = 200;
	private final int CARPENTER_MONEY = 300;
	private final int BANKER_MONEY = 500;
	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		m = new Menu();
		partyNames = new ArrayList<String>();
		partyNames.add("jimmy");
		partyNames.add("timmy");
		partyNames.add("limmy");
		partyNames.add("fimmy");
	}

	/**
	 * Test method for {@link Menu#startUpMenu(java.lang.String, java.util.List, Profession, enums.TravelPace, enums.RationLevel)}.
	 */
	@Test
	public final void testStartUpMenu() {
		m.startUpMenu("Ira", partyNames, Profession.BANKER, TravelPace.FAST, RationLevel.HIGH);
		// Test the amount of money being allocated
		assertEquals((int)m.getWorldstate().getTravelGroup().getMoney(), BANKER_MONEY);
		
		// Test that the party names are getting assigned properly
		assertEquals(m.getWorldstate().getTravelGroup().getParty()[0].getName() , "Ira");
		assertEquals(m.getWorldstate().getTravelGroup().getParty()[1].getName() , "jimmy");
		assertEquals(m.getWorldstate().getTravelGroup().getParty()[2].getName() , "timmy");
		assertEquals(m.getWorldstate().getTravelGroup().getParty()[3].getName() , "limmy");
		assertEquals(m.getWorldstate().getTravelGroup().getParty()[4].getName() , "fimmy");
		
		//Test that the pace is correct
		assertEquals(m.getWorldstate().getTravelGroup().getTravelPace(), TravelPace.FAST);
		
		m.startUpMenu("Ira", partyNames, Profession.FARMER, TravelPace.FAST, RationLevel.HIGH);
		// Test the amount of money being allocated
		assertEquals((int)m.getWorldstate().getTravelGroup().getMoney(), FARMER_MONEY);
		
		m.startUpMenu("Ira", partyNames, Profession.CARPENTER, TravelPace.FAST, RationLevel.HIGH);
		// Test the amount of money being allocated
		assertEquals((int)m.getWorldstate().getTravelGroup().getMoney(), CARPENTER_MONEY);
	}

}
